8740 REM ---------------------- RENUM 8740,XXX,20 -----------------------------
8760 REM ---------------- EDITSUB.BAS - LAST UPDATE 11/27/88 ------------------
8780 REM ------ OUTLINE A WORK AREA AND A PROMPT AREA --- ENTER WITH MSG$ -----
8800 CLS:ROW=1:FOR COL=1 TO 80:LOCATE ROW,COL:PRINT CHR$(223);:NEXT
8820 ROW=3:FOR COL=1 TO 80:LOCATE ROW,COL:PRINT CHR$(223);:NEXT
8840 ROW=19:FOR COL=1 TO 80:LOCATE ROW,COL:PRINT CHR$(223);:NEXT
8860 ROW=25:FOR COL=1 TO 80:LOCATE ROW,COL:PRINT CHR$(220);:NEXT
8880 COL=1:FOR ROW=1 TO 25:LOCATE ROW,COL:PRINT CHR$(219);:NEXT
8900 COL=80:FOR ROW=1 TO 25:LOCATE ROW,COL:PRINT CHR$(219);:NEXT
8920 FOR ROW=1 TO 2:COL=19:LOCATE ROW,COL:PRINT CHR$(219);:NEXT
8940 FOR ROW=1 TO 2:COL=64:LOCATE ROW,COL:PRINT CHR$(219);:NEXT
8960 ROW=2:GOSUB 9200:RETURN
8980 REM ------------------------ ERASE WORK AREA ------------------------------
9000 FOR ROW=4 TO 18:LOCATE ROW,2:PRINT SPACE$(78);:NEXT ROW:RETURN
9020 REM
9040 REM
9060 REM ----------------------- ERASE PROMPT AREA ----------------------------
9080 REM
9100 FOR ROW=20 TO 24:LOCATE ROW,2:PRINT SPACE$(78);:NEXT ROW:RETURN
9120 END
9140 REM ------------------- PRINT STRING CENTERED IN ROW ----------------------
9160 REM ---------------------- ENTER WITH MSG$, ROW ---------------------------
9180 REM
9200 COL=40-(LEN(MSG$)/2):GOSUB 9400:RETURN
9220 END
9240 REM ---------------- CENTER PROMPT AND STRING EDIT IN ROW -----------------
9260 REM --------- ENTER WITH MSG$, ROW, TEMP$, LNG - EXIT WITH TEMP$ ----------
9280 REM
9300 COL=40-((LEN(MSG$)/2)+1+(LNG/2)):GOSUB 9400
9320 COL=COL+LEN(MSG$)+2:GOSUB 9500:RETURN
9340 REM
9360 REM ------------- PRINT STRING - ENTER WITH MSG$, ROW, COL ----------------
9380 REM
9400 LOCATE ROW,COL:PRINT MSG$;:RETURN
9420 REM
9440 REM ---------------- EDIT STRING ---------- USES IN$, A -------------------
9460 REM ---------- ENTER WITH TEMP$, ROW, COL, LNG - EXIT WITH TEMP$ ----------
9480 REM
9500 LOCATE ROW,COL,1:COLOR 0,7:PRINT TEMP$;        :REM  PRINT STRING
9520 FOR A=1 TO LNG-LEN(TEMP$):PRINT " ";:NEXT      :REM  REVERSE VIDEO FIELD
9540 FOR A=1 TO LNG-LEN(TEMP$):PRINT CHR$(29);:NEXT :REM  BACK UP TO LAST CHAR
9560 IN$=INKEY$:IF IN$="" THEN 9560                 :REM  WAIT FOR KEY
9580 IF IN$=CHR$(13) THEN 9820                      :REM  RETURN KEY
9600 IF IN$=CHR$(8) THEN 9740                       :REM  BACKSPACE KEY
9620 IF IN$=CHR$(27) THEN TEMP$=CHR$(27):GOTO 9820  :REM  ESCAPE KEY
9640 IF ASC(IN$)<32 OR ASC(IN$)>126 THEN 9560       :REM  ILLEGAL CHARACTER
9660 IF LEN(TEMP$)>LNG-1 THEN BEEP:GOTO 9560        :REM  NO MORE CHARS ALLOWED
9680 PRINT IN$;:TEMP$=TEMP$+IN$                     :REM  GOOD CHARACTER
9700 IF LEN(TEMP$)=LNG THEN PRINT CHR$(29);         :REM  MOVE CURSOR IF LAST
9720 IF LNG=1 THEN GOTO 9820 ELSE GOTO 9560         :REM  RETURN IF LNG=1
9740 IF LEN(TEMP$)=0 THEN BEEP:GOTO 9560            :REM  BAD BS - NO CHARS
9760 TEMP$=LEFT$(TEMP$,LEN(TEMP$)-1)                :REM  IF GOOD BACKSPACE
9780 IF LEN(TEMP$)<>LNG-1 THEN PRINT CHR$(29);      :REM  MOVE CURSOR IF LAST
9800 PRINT " ";CHR$(29);:GOTO 9560                  :REM  IF GOOD BACKSPACE
9820 COLOR 7,0:RETURN                               :REM  COMMON EXIT
9840 REM
9885 REM ----------------------- RENUM 9885,XXXX,5 -----------------------------
9890 REM ------------ GET A FUNCTION KEY AND DISPLAY DATE AND TIME -------------
9895 REM ------------ EXIT WITH FUNCT$="F1"-"F0" (F10) - USES IN$ --------------
9900 LOCATE ,,0
9905 IN$=INKEY$:IF IN$<>"" THEN 9915
9910 LOCATE 2,3:PRINT "DATE "+DATE$;:LOCATE 2,66:PRINT "TIME "+TIME$;:GOTO 9905
9915 IF IN$=CHR$(0)+CHR$(59) THEN FUNCT$="F1":GOTO 9970
9920 IF IN$=CHR$(0)+CHR$(60) THEN FUNCT$="F2":GOTO 9970
9925 IF IN$=CHR$(0)+CHR$(61) THEN FUNCT$="F3":GOTO 9970
9930 IF IN$=CHR$(0)+CHR$(62) THEN FUNCT$="F4":GOTO 9970
9935 IF IN$=CHR$(0)+CHR$(63) THEN FUNCT$="F5":GOTO 9970
9940 IF IN$=CHR$(0)+CHR$(64) THEN FUNCT$="F6":GOTO 9970
9945 IF IN$=CHR$(0)+CHR$(65) THEN FUNCT$="F7":GOTO 9970
9950 IF IN$=CHR$(0)+CHR$(66) THEN FUNCT$="F8":GOTO 9970
9955 IF IN$=CHR$(0)+CHR$(67) THEN FUNCT$="F9":GOTO 9970
9960 IF IN$=CHR$(0)+CHR$(68) THEN FUNCT$="F0":GOTO 9970
9965 GOTO 9905
9970 LOCATE 2,3:PRINT "               ";:LOCATE 2,66:PRINT "             ";
9975 LOCATE ,,1:RETURN
9980 REM ------- STORE FILE NAMES OF A SPECIFIED EXTENSION IN AN ARRAY -------
9985 REM ----------------- TO BE USED BY THE NEXT ROUTINE. -------------------
9990 REM --------------- ENTER WITH EXT$, EXIT WITH NUMFILES -----------------
9995 REM
10000 DIM FILENAME$(256,8)
10005 SHEL$="DIR *."+EXT$+" > FILES.TMP"
10010 SHELL SHEL$
10015 OPEN "FILES.TMP" FOR INPUT AS 1
10020 NUMFILES=0:FROW=1:FCOL=1:MAXROW=1:MAXCOL=1
10025 IF EOF(1) THEN 10095
10030 INPUT #1,FILE$
10035 EXTPOS=INSTR(FILE$," "+EXT$)-1
10040 IF EXTPOS<1 OR LEN(FILE$)=0 THEN 10090
10045 FILE$=LEFT$(FILE$,EXTPOS)
10050 SPCPOS=INSTR(FILE$," ")-1
10055 IF SPCPOS<1 OR LEN(FILE$)=0 THEN 10065
10060 FILE$=LEFT$(FILE$,SPCPOS)
10065 FILENAME$(FROW,FCOL)=FILE$
10070 NUMFILES=NUMFILES+1
10075 FCOL=FCOL+1
10080 IF FCOL=9 THEN FCOL=1:FROW=FROW+1
10085 IF FCOL>MAXCOL THEN MAXCOL=FCOL
10090 GOTO 10025
10095 MAXROW=FROW:IF MAXROW=1 THEN MAXCOL=MAXCOL-1
10100 CLOSE 1:KILL "FILES.TMP"
10105 RETURN
10110 REM
10115 REM --------- DISPLAY AND SELECT FILE NAME FROM NAMES STORED --------
10120 REM -------------- IN AN ARRAY BY THE PREVIOUS ROUTINE --------------
10125 REM ------ ENTER WITH ROW (ON WHICH TO START DISPLAYING FILES) ------
10130 REM ------- EXIT WITH FILE$ (CHR$(27) IF ESCAPE KEY WAS HIT) --------
10135 REM ----- MOVE TO NAME WITH ARROW KEYS, SELECT FILE WITH RETURN -----
10140 REM
10145 REM ----- DISPLAY FILE NAMES
10150 FOR DROW=1 TO FROW
10155  FOR DCOL=1 TO MAXCOL
10160   LOCATE DROW-1+ROW,((DCOL-1)*10)+1
10165   PRINT FILENAME$(DROW,DCOL)
10170  NEXT DCOL
10175 NEXT DROW
10180 REM ----- MOVE THROUGH FILE NAMES AND SELECT ONE
10185 LOCATE ,,0:FROW=1:FCOL=1:OLDFROW=FROW:OLDFCOL=FCOL
10190 LOCATE FROW-1+ROW,FCOL
10195 COLOR BLACK+BLINK,WHITE:PRINT FILENAME$(FROW,FCOL):COLOR WHITE,BLACK
10200 LOCATE FROW-1+ROW,FCOL
10205 IN$=INKEY$:IF IN$="" THEN 10205
10210 IF IN$=CHR$(13) THEN 10320
10215 IF IN$=CHR$(27) THEN FILE$=CHR$(27):GOTO 10325
10220 IF IN$=CHR$(0)+CHR$(75) THEN 10245:REM LEFT
10225 IF IN$=CHR$(0)+CHR$(77) THEN 10255:REM RIGHT
10230 IF IN$=CHR$(0)+CHR$(72) THEN 10265:REM UP
10235 IF IN$=CHR$(0)+CHR$(80) THEN 10275:REM DOWN
10240 GOTO 10205
10245 IF FCOL>1 THEN OLDFROW=FROW:OLDFCOL=FCOL:FCOL=FCOL-1
10250 GOTO 10285
10255 IF FCOL<MAXCOL THEN OLDFROW=FROW:OLDFCOL=FCOL:FCOL=FCOL+1
10260 GOTO 10285
10265 IF FROW>1 THEN OLDFROW=FROW:OLDFCOL=FCOL:FROW=FROW-1
10270 GOTO 10285
10275 IF FROW<MAXROW THEN OLDFROW=FROW:OLDFCOL=FCOL:FROW=FROW+1
10280 GOTO 10285
10285 IF FILENAME$(FROW,FCOL)<>"" THEN 10295
10290 FROW=OLDFROW:FCOL=OLDFCOL
10295 LOCATE OLDFROW-1+ROW,((OLDFCOL-1)*10)+1
10300 PRINT FILENAME$(OLDFROW,OLDFCOL)
10305 LOCATE FROW-1+ROW,((FCOL-1)*10)+1
10310 COLOR BLACK+BLINK,WHITE:PRINT FILENAME$(FROW,FCOL):COLOR WHITE,BLACK
10315 GOTO 10205
10320 FILE$=FILENAME$(FROW,FCOL)
10325 ERASE FILENAME$:LOCATE ,,1:RETURN
